import request from '@/utils/request'

// 创建渠道单退单
export function create(data) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/create',
    method: 'post',
    data: data
  })
}

// 更新渠道单退单
export function update(data) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/update',
    method: 'put',
    data: data
  })
}

// 获得渠道单退单
export function get(id) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/get?id=' + id,
    method: 'get'
  })
}

// 获得渠道单退单分页
export function getPage(query) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/page',
    method: 'get',
    params: query
  })
}

// 导出渠道单退单 Excel
export function exportExcel(query) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 同意
export function consentRefund(data) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/consentRefund',
    method: 'put',
    data: data
  })
}

// 驳回
export function turnDownRefund(data) {
  return request({
    url: '/pekingfish/appChannelOrderRefund/turnDownRefund',
    method: 'put',
    data: data
  })
}


export function takeDelivery(id,merchantOrderNo) {
  const data = {
    id,
    merchantOrderNo
  }
  return request({
    url: '/pekingfish/appChannelOrderRefund/takeDelivery',
    method: 'put',
    data: data
  })
}
